%{--
This file is part of dbdjasperreport.

Copyright (C) 2008 Kue Vang aka Kou
Licensed under the Eclipse Public License, Version 1.0; 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at http://www.eclipse.org/legal/epl-v10.html 
Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and limitations 
under the License.
--}%

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
		<resource:dateChooser/>
        <title>Edit System</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">System List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New System</g:link></span>
        </div>
        <div class="body">
            <h1>Edit System</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${reportSystem}">
            <div class="errors">
                <g:renderErrors bean="${reportSystem}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${reportSystem?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="codeSystem">System Code:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'codeSystem','errors')}">
                                    <input type="text" id="codeSystem" name="codeSystem" value="${fieldValue(bean:reportSystem,field:'codeSystem')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="descrSystem">System Description:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'descrSystem','errors')}">
                                    <input type="text" id="descrSystem" name="descrSystem" value="${fieldValue(bean:reportSystem,field:'descrSystem')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reportDirectory">Report Directory:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'reportDirectory','errors')}">
                                    <input class="orderByText" type="text" id="reportDirectory" name="reportDirectory" value="${fieldValue(bean:reportSystem,field:'reportDirectory')}"/>
                                </td>
                            </tr> 
                        
							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="databaseType">Database Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'databaseType','errors')}">
                                    <g:select id="databaseType" name="databaseType" from="${reportSystem.constraints.databaseType.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportSystem,field:'databaseType')}" ></g:select>
                                </td>
                            </tr>
							
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="systemEnded">System Ended:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'systemEnded','errors')}">
                                    <g:select id="systemEnded" name="systemEnded" from="${reportSystem.constraints.systemEnded.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportSystem,field:'systemEnded')}" ></g:select>
                                </td>
                            </tr> 
                                                
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="reports">Reports:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportSystem,field:'reports','errors')}">
                                    
<ul>
<g:each var="r" in="${reportSystem?.reports?}">
    <li><g:link controller="report" action="show" id="${r.id}">${r}</g:link></li>
</g:each>
</ul>
<g:link controller="report" params="["reportSystem.id":reportSystem?.id]" action="create"><p class="childLink">Add Report</p></g:link>

                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
